/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import org.hibernate.criterion.Criterion;

import com.taobao.snowsnow.hibernate.dao.ExpressRecordDao;
import com.taobao.snowsnow.hibernate.pojo.ExpressRecord;
import com.taobao.snowsnow.hibernate.service.ExpressRecordService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class ExpressRecordServiceImpl extends BaseServiceImpl implements ExpressRecordService {
	private ExpressRecordDao edao;
	
	public List<ExpressRecord> findAll() throws Exception {
		try {
			return edao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
			throw e;
		}
	}

	public ExpressRecord findById(int id) throws Exception {
		try {
			return edao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
			throw e;
		}
	}
	
	public List<ExpressRecord> findByName(String name) throws Exception {
		try {
			return edao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
			throw e;
		}
	}

	public long getTotal() throws Exception  {
		try {
			return edao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
			throw e;
		}
	}

	public List<ExpressRecord> paging(int page, int limit) throws Exception  {
		try {
			return edao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
			throw e;
		}
	}

	public void setEdao(ExpressRecordDao edao) {
		this.edao = edao;
	}

	public ExpressRecordDao getEdao() {
		return edao;
	}

	@Override
	public ExpressRecord getFirstObject() throws Exception {
		try {
			return edao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("ExpressRecord getFirstObject()");
			throw e;
		}
	}

	@Override
	public ExpressRecord getLastObject() throws Exception {
		try {
			return edao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("ExpressRecord getLastObject()");
			throw e;
		}
	}

	@Override
	public ExpressRecord findByNamePrecise(String name) throws Exception {
		try {
			return edao.findByNamePrecise(name);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("ExpressRecord getLastObject()");
			throw e;
		}
	}

	@Override
	public List<ExpressRecord> findByCriteria(List<Criterion> expression)
			throws Exception {
		try {
			return edao.findByCriteria(expression);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("ExpressRecord findByCriteria()");
			throw e;
		}
	}
}
